package com.zxmzy.scaffold.core.ext

import android.content.res.Resources

/**
 * @author zhangxiaoming
 * @date 2023/7/27
 * @description
 */
fun Number.dp(): Int {
    val dpValue = toFloat()
    val scale: Float = Resources.getSystem().displayMetrics.density
    return (dpValue * scale + 0.5f).toInt()
}

fun Number.sp(): Int {
    val spValue = toFloat()
    val scale = Resources.getSystem().displayMetrics.scaledDensity
    return (spValue * scale + 0.5f).toInt()
}
